package com.ruoyi.edu.service.impl;

import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.apache.commons.lang3.StringUtils;
import com.ruoyi.edu.mapper.EduCommentMapper;
import com.ruoyi.edu.domain.EduComment;
import com.ruoyi.edu.service.IEduCommentService;

import java.util.List;
import java.util.Map;

/**
 * 评论Service业务层处理
 *
 * @author niruichen
 * @date 2020-12-22
 */
@Service
public class EduCommentServiceImpl extends ServiceImpl<EduCommentMapper, EduComment> implements IEduCommentService {

    @Override
    public List<EduComment> queryList(EduComment eduComment) {
        LambdaQueryWrapper<EduComment> lqw = Wrappers.lambdaQuery();
        if (StringUtils.isNotBlank(eduComment.getCourseId())){
            lqw.eq(EduComment::getCourseId ,eduComment.getCourseId());
        }
        if (StringUtils.isNotBlank(eduComment.getMemberId())){
            lqw.eq(EduComment::getMemberId ,eduComment.getMemberId());
        }
        if (StringUtils.isNotBlank(eduComment.getNickname())){
            lqw.like(EduComment::getNickname ,eduComment.getNickname());
        }
        return this.list(lqw);
    }
}
